package com.fandou.airobot.domain.request;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.fandou.airobot.data.bean.HomeItem;
import com.fandou.airobot.data.repository.DataRepository;

import java.util.List;

public class HomeItemRequest implements Request.IHomeItemRequest {

    private MutableLiveData<List<HomeItem>> homeItemLiveData;

    @Override
    public LiveData<List<HomeItem>> getHomeItemLiveData() {
        if (homeItemLiveData == null) {
            homeItemLiveData = new MutableLiveData<>();
        }
        return homeItemLiveData;
    }

    @Override
    public void requestHomeItem() {
        DataRepository.getInstance().getHomePageItems(homeItemLiveData);
    }
}
